package defs

// Err 错误
type Err struct {
	// 错误信息
	Error string `json:"error"`
	// 错误编码
	ErrorCode string `json:"error_code"`
}

type ErrorResponse struct {
	HttpSC int
	Error  Err
}

var (
	// 请求无法解析错误 001
	ErrorRequestBodyParseFailed = ErrorResponse{HttpSC: 400, Error: Err{Error: "Request body is not correct.", ErrorCode: "001"}}
	// 用户无法通过验证 002
	ErrorNotAuthUser = ErrorResponse{HttpSC: 401, Error: Err{Error: "User authentication failed.", ErrorCode: "002"}}
	// 数据查询错误
	ErrorDBError = ErrorResponse{HttpSC: 500, Error: Err{Error: "DB ops failed", ErrorCode: "003"}}
	// 内部错误
	ErrorInternalFaults = ErrorResponse{HttpSC: 500, Error: Err{Error: "Internal server errror", ErrorCode: "004"}}
)
